<?php

/**
 * 应用操作
 * 注意：OAuth模块属于应用之一
 * 
 * @author ShuangYa
 * @package EUser
 * @category Service
 * @link http://www.sylingd.com/
 * @copyright Copyright (c) 2015-2016 ShuangYa
 * @license http://lab.sylingd.com/go.php?name=euser&type=license
 */

namespace euser\service;
use \sy\lib\YSecurity;
use \sy\lib\db\YMongoDB;

class App {
	protected static $_instance = NULL;
	public static function i() {
		if (self::$_instance === NULL) {
			self::$_instance = new self;
		}
		return self::$_instance;
	}
	public function __construct() {
		
	}
	/**
	 * 获取Client信息
	 * @access public
	 * @param int $id
	 * @return string
	 */
	public function getClient($id) {
		$r = YMongoDB::i()->select('app')->getOne(['_id' => YMongoDB::MongoID($id)]);
		return $r;
	}
	/**
	 * 生成签名校验字符串
	 * @access public
	 * @param string $data 数据
	 * @param string $key 加密key
	 * @return string
	 */
	public function createSign($data, $key) {
		return hash_hmac('md5', $data, $key);
	}
}